package com.ym.jiujiangeyou.fragment;

import com.ym.jiujiangeyou.CollectList;

import com.ym.jiujiangeyou.HotelCollectList;
import com.ym.jiujiangeyou.R;
import com.ym.jiujiangeyou.util.Constants;


import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
 /**   
 * @author 叶铭   
 * @email yeming_1001@163.com
 * @version V1.0   
 */
public class CollectFragment extends Fragment implements OnClickListener{

	public CollectFragment() {
	}

	TextView  title_text ;
	RelativeLayout reScenery,reHotel,reOther ;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		
		View view = inflater.inflate(R.layout.collect, null, false) ;
		initResources(view) ;
		reHotel.setOnClickListener(this) ;
		reScenery.setOnClickListener(this) ;
		reOther.setOnClickListener(this) ;
		return view;

	}
	
	public void initResources(View view){
		
		title_text = (TextView) view.findViewById(R.id.title_text) ;
		reHotel = (RelativeLayout) view.findViewById(R.id.hotel_collect_item) ;
		reScenery = (RelativeLayout) view.findViewById(R.id.scenery_collect_item) ;
		reOther = (RelativeLayout) view.findViewById(R.id.other_collect_item) ;
		
		title_text.setText(R.string.title_text_collect) ;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.hotel_collect_item :
			Toast.makeText(getActivity(), R.string.text_collect_hotel, 0).show() ;
			Intent intent1 = new Intent(getActivity(), HotelCollectList.class) ;
			intent1.putExtra("action", Constants.LISTVIEW_ACTION_GET_HOTEL) ;
			startActivity(intent1) ;
			break;
		case R.id.scenery_collect_item :
			Toast.makeText(getActivity(), R.string.text_collect_scenery, 0).show() ;
			Intent intent = new Intent(getActivity(), CollectList.class) ;
			intent.putExtra("action", Constants.LISTVIEW_ACTION_GET_SCENERY) ;
			startActivity(intent) ;
			break ;
		case R.id.other_collect_item :
			Toast.makeText(getActivity(), R.string.text_collect_other, 0).show() ;
		break ;
		default:
			break;
		}
	}



}
